<?php
/**
 * boatModel.php
 * This file holds the rules and settings for all boats
 *
 * @author Peter, Thomas, Tryggve
 * @version 0.1
 * @copyright Oh, yes!
 * @package default
 */

 // requires boatClass
require_once("models/boatClass.php") ;
require_once("models/baseModel.php") ;

/**
 * @package default
 * @subpackage classes
 */
class BoatModel extends BaseModel {
	
	

    // declare some constants for table and class name
    const TABLE_NAME = 'boats' ;
    const TABLE_ID = 'boatId' ;
    const CLASS_NAME = 'BoatClass' ;
    
    /**
     * create
     */
    public function create($a_boatInfo) {
    	
				var_dump($a_boatInfo);
        
        if(ValidationModel::validateBoatInfo($a_boatInfo) AND parent::create($a_boatInfo)) {
            $this::addMessage("Båten har blivit skapad!") ;
        } else {
            $this::addMessage("Båten kunde inte skapas!") ;
        }
        
    }
    
    /*public function read($a_id = null, $a_table = null) {

        parent::read($a_id, $a_table) ;
        
    } */
    
    public function update($a_boatInfo) {
        
        if(ValidationModel::validateBoatInfo($a_boatInfo) AND parent::update($a_boatInfo)) {
            $this::addMessage("Båten har blivit ändrad!") ;
        } else {
            $this::addMessage("Båten kunde inte ändras!") ;
        }
        
    }
    
    
    /**
     * delete
     * 
     * @param int $a_id
     * 
     * @return boolean
     * 
     */
    public function delete($a_boatId) {
            
        if(parent::delete($a_boatId)) {
            $this::addMessage("Båten har blivit borttagen!") ;
        } else {
            $this::addMessage("Båten kunde inte tas bort!") ;
        }
    } 
}
